<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Adaptively resize image with data dependent triangulation</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagick.adaptiveblurimage.html">Imagick::adaptiveBlurImage</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagick.adaptivesharpenimage.html">Imagick::adaptiveSharpenImage</a></div>
 <div class="up"><a href="class.imagick.html">Imagick</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="imagick.adaptiveresizeimage" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Imagick::adaptiveResizeImage</h1>
  <p class="verinfo">(PECL imagick 2.0.0)</p><p class="refpurpose"><span class="refname">Imagick::adaptiveResizeImage</span> &mdash; <span class="dc-title">Adaptively resize image with data dependent triangulation</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-imagick.adaptiveresizeimage-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>Imagick::adaptiveResizeImage</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$columns</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$rows</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$bestfit</code><span class="initializer"> = false</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Adaptively resize image with data-dependent triangulation. Avoids
   blurring across sharp color changes. Most useful when used to shrink
   images slightly to a slightly smaller &quot;web size&quot;; may not look good
   when a full-sized image is adaptively resized to a thumbnail.
   此方法在Imagick基于ImageMagick 6.2.9以上版本编译时可用。
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
<span class="simpara">
 参数 <em><code class="parameter">bestfit</code></em> 的特性在 Imagick 3.0.0 中已改变。在此版本以前，当目标尺寸设为
 400x400 时，原尺寸为 200x150 的图像将不会被改变。自 Imagick 3.0.0
 起，源图像将会被放大到 400x300 因为这将更好的适合目标尺寸。当使用参数
 <em><code class="parameter">bestfit</code></em> 时，必须同时给出宽度和高度。
</span>
</p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-imagick.adaptiveresizeimage-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">columns</code></em></dt>

     <dd>

      <p class="para">
       The number of columns in the scaled image.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">rows</code></em></dt>

     <dd>

      <p class="para">
       The number of rows in the scaled image.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">bestfit</code></em></dt>

     <dd>

      <p class="para">
       Whether to fit the image inside a bounding box.
      </p>
     </dd>

    
   </dl>

  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-imagick.adaptiveresizeimage-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-imagick.adaptiveresizeimage-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   错误时抛出 ImagickException。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-imagick.adaptiveresizeimage-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>2.1.0</td>
       <td>Added optional fit parameter.</td>
      </tr>

      <tr>
       <td>2.1.0</td>
       <td>
       This method now supports proportional scaling.
       Pass zero as either parameter for proportional scaling.  
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-imagick.adaptiveresizeimage-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3216">
    <p><strong>Example #1 Using <span class="function"><strong>Imagick::adaptiveResizeImage()</strong></span></strong></p>
    <div class="example-contents"><p>
     Resize an image to a standard size for the web.  This method works best
     when resizing to a size only slightly smaller than the previous image
     size.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;image/jpeg'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$image&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">'image.jpg'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$image</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">adaptiveResizeImage</span><span style="color: #007700">(</span><span style="color: #0000BB">1024</span><span style="color: #007700">,</span><span style="color: #0000BB">768</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #0000BB">$image</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-imagick.adaptiveresizeimage-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="imagick.chopimage.html" class="function" rel="rdfs-seeAlso">Imagick::chopImage()</a> - Removes a region of an image and trims</span></li>
    <li class="member"><span class="function"><a href="imagick.cropimage.html" class="function" rel="rdfs-seeAlso">Imagick::cropImage()</a> - Extracts a region of the image</span></li>
    <li class="member"><span class="function"><a href="imagick.magnifyimage.html" class="function" rel="rdfs-seeAlso">Imagick::magnifyImage()</a> - Scales an image proportionally 2x</span></li>
    <li class="member"><span class="function"><a href="imagick.minifyimage.html" class="function" rel="rdfs-seeAlso">Imagick::minifyImage()</a> - Scales an image proportionally to half its size</span></li>
    <li class="member"><span class="function"><a href="imagick.resizeimage.html" class="function" rel="rdfs-seeAlso">Imagick::resizeImage()</a> - Scales an image</span></li>
    <li class="member"><span class="function"><a href="imagick.scaleimage.html" class="function" rel="rdfs-seeAlso">Imagick::scaleImage()</a> - Scales the size of an image</span></li>
    <li class="member"><span class="function"><a href="imagick.shaveimage.html" class="function" rel="rdfs-seeAlso">Imagick::shaveImage()</a> - Shaves pixels from the image edges</span></li>
    <li class="member"><span class="function"><a href="imagick.thumbnailimage.html" class="function" rel="rdfs-seeAlso">Imagick::thumbnailImage()</a> - Changes the size of an image</span></li>
    <li class="member"><span class="function"><a href="imagick.trimimage.html" class="function" rel="rdfs-seeAlso">Imagick::trimImage()</a> - Remove edges from the image</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagick.adaptiveblurimage.html">Imagick::adaptiveBlurImage</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagick.adaptivesharpenimage.html">Imagick::adaptiveSharpenImage</a></div>
 <div class="up"><a href="class.imagick.html">Imagick</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
